package com.wing.sys.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wing.common.util.GUID;
import com.wing.common.util.PageBean;
import com.wing.sys.dao.OperatelogDao;
import com.wing.sys.domain.Operatelog;
/**
 * 
 * @author please write yout name
 * 
 */
@Service
@Transactional
public class OperatelogManager {
	@Autowired
	private OperatelogDao operatelogdao;
	
	
	/**
	 * 获得该对象所有数据的列表
	 * 
	 * @return list
	 */
	public List<Map<String,Object>> findAll(){
		return operatelogdao.findAll();	 
	}
	
	public PageBean findPageList(int currentPage, int pageSize){
		return operatelogdao.findPageList(currentPage,pageSize);	 
	}
	
	/**
	 * 通过id得到对象
	 *
	 * @param  id
	 * @return pObject
	 */
	public Operatelog findById(String id){
		return operatelogdao.findById(id);	 
	}
	
	/**
	 * 保存对象
	 *
	 * @param  operatelog
	 */
	public void saveOperatelog(Operatelog operatelog){
		if(operatelog.getId() == null ||  "".equals(operatelog.getId())){
			operatelog.setId(new GUID().toString());
			operatelogdao.insert(operatelog);
		}else{
			operatelogdao.update(operatelog);
		}
	}

	/**
	 * 编辑对象
	 *
	 * @param  operatelog
	 */
	public void updateOperatelog(Operatelog operatelog){
		operatelogdao.update(operatelog);
	}
	
	 /**
	 * 删除对象
	 *
	 * @param  chk 对象id数组
	 */
	public void deleteOperatelogs(String[] chk) {
		for(int i=0;i<chk.length;i++){
			operatelogdao.delete(chk[i]);
		}
	}
}



